package com.luoye.lj.platform.service.impl;

import com.luoye.lj.platform.service.IManageMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import com.luoye.lj.platform.dao.IManageMenuDao;
import com.luoye.lj.platform.pojo.dbo.ManageMenuDbo;
import com.luoye.lj.platform.pojo.dbo.ManageMenuDboSearchCondition;
import com.luoye.lj.platform.pojo.dbo.ManageMenuDboCollection;

import org.springframework.dao.DuplicateKeyException;


/**
 * Created with IntelliJ IDEA.
 * User:
 * Date:
 * Time:
 * To change this template use File | Settings | File Templates.
 */
@Service
@Slf4j
public class ManageMenuServiceImpl implements IManageMenuService {
    @Autowired
    private IManageMenuDao manageMenuDao;

    @Override
    public ManageMenuDbo insert(ManageMenuDbo manageMenuDbo) throws DuplicateKeyException {
        int rowCount=manageMenuDao.insert(manageMenuDbo);
        if(rowCount>0){
            return manageMenuDbo;
        }
        return null;
    }

    @Override
    public int delete(long id) {
        return manageMenuDao.delete(id);
    }

    @Override
    public int update(ManageMenuDbo manageMenuDbo) {
        return manageMenuDao.update(manageMenuDbo);
    }

    @Override
    public ManageMenuDbo get(long id) {
        return manageMenuDao.get(id);
    }

    @Override
    public ManageMenuDboCollection searchByCondition(ManageMenuDboSearchCondition manageMenuDboSearchCondition) {
        return manageMenuDao.searchByCondition(manageMenuDboSearchCondition);
    }

    @Override
    public List<ManageMenuDbo> deleteByCondition(ManageMenuDboSearchCondition manageMenuDboSearchCondition){
        return manageMenuDao.deleteByCondition(manageMenuDboSearchCondition);
    }

    @Override
    public ManageMenuDbo statisticsByCondition(ManageMenuDboSearchCondition manageMenuDboSearchCondition) {
        return manageMenuDao.statisticsByCondition(manageMenuDboSearchCondition);
    }

    @Override
    public long getMaxId() {
        return manageMenuDao.getMaxId();
    }

}
